#!/usr/bin/env gosh
(use srfi-1)
(use sxml.ssax)
(use sxml.serializer)
(use sxml.tools)
(use sxml.sxpath)
(use sxml.tree-trans)
(use gauche.sequence)
(use gauche.process)
(use gauche.parseopt)

(define (main args)
  (let-args (cdr args)
      ((option-v "v|valuepath=s" "")
       . file)
    (define sxml (if (null? file)
		   (ssax:xml->sxml (current-input-port) '())
		   (call-with-input-file (car file) (lambda (in)
						      (ssax:xml->sxml in '())))))
    (define path-value (sxpath option-v))
    (for-each print (path-value sxml))))
